package com.xiaoming.e3mall.portal.controller;

import com.xiaoming.e3mall.content.service.ContentService;
import com.xiaoming.e3mall.pojo.TbContent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * 首页展示Controller
 */

@Controller
public class IndexContorller {

    @Value("${CONTENT_LUNBO_ID}")
    private Long CONTENT_LUNBO_ID;

    @Autowired
    private ContentService contentService;


    //配置欢迎页为 index.html
    @RequestMapping("/index")
    public  String  showIndex(Model model){
        //查询列表
        List<TbContent> ad1List = contentService.getContentByCid(CONTENT_LUNBO_ID);
        //将结果转发给页面
        model.addAttribute("ad1List",ad1List);
        return "index.jsp";
    }





}
